<template>
  <el-container class="all">
    <el-header class="head">
      <div>
        <!--                <img style="height: 60px;width: 60px" src="" alt="tihs is a pic">-->
        <span style="padding-left: 2vw">欢迎你 {{this.name}}</span>
      </div>
      <el-button type="info" @click="out">退出</el-button></el-header>
    <el-container>
      <el-aside :width="iscoll?'65px':'200px'" class="aside">
        <div class="toggle-btn" @click="togg">|||</div>
        <el-menu
                background-color="#404040"
                text-color="#fff"
                active-text-color="#87CEEB"
                unique-opened
                :collapse="iscoll"
                :collapse-transition="false"
                router

        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>关于项目</span>
            </template>
            <el-menu-item index="/user/home/allproject">显示所有项目</el-menu-item>
            <el-menu-item index="/user/home/delmyproject">删除我的项目</el-menu-item>
            <el-menu-item index="/user/home/new">添加我的项目</el-menu-item>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span>个人中心</span>
            </template>
            <el-menu-item index="/user/home/changepass">修改用户密码</el-menu-item>
          </el-submenu>
        </el-menu></el-aside>
      <el-main class="main"><router-view></router-view></el-main>
    </el-container>
  </el-container>
</template>

<script>
import {RemoveTokenUser,getTokenUser} from "../../utils/auth";

export default {
  name: 'Home',
  data(){
    return{
      iscoll:false,
      name:""
    }
  },
  mounted() {
    this.name = getTokenUser()
  },
  methods:{
    out(){
      RemoveTokenUser();
      this.$router.push("/user/login")
    },

    togg(){
      this.iscoll = !this.iscoll
    },

  }
}
</script>

<style lang="less" scoped>
  .head{
    background-color: #666666;
    display: flex;
    justify-content: space-between;
    padding-left: 0;
    align-items: center;
    color: white;
    font-size: 20px;
    >div{
      display: flex;
      align-items: center;

      span{
        margin-left: 10px;
      }
    }
  }
  .aside{
    background-color: #404040;
  }
  .main{
    background-color: whitesmoke;
  }
  .all{
    height: 100%;
  }
  .iconfont{
    padding-right: 10px;
  }
  .el-menu{
    border-right:none ;
  }
  .toggle-btn{
    background-color: #666666;
    font-size: 10px;
    line-height: 24px;
    color: white;
    text-align: center;
    letter-spacing: 0.3em;
    cursor: pointer;
  }

</style>
